﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows;

namespace Faust.Andrew.MTG.Player.Converters
{
    public class ListToStringConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            StringBuilder lines = new StringBuilder();

            if (value is IEnumerable<string>)
            {
                foreach (string line in ((IEnumerable<string>)value))
                {
                    lines.AppendLine(line);
                }
            }

            return lines;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
